﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace broker.duty.RB
{
    class Class6
    {
        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Period > 0 && ppa.Age <= 30)
            {
                da.Value = ppa.Amount * ppa.Age * 0.01;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            string s = ppa.PolicyActing.Policy.SelectedColRateFactors["养老金领取年龄"];

            int a = s == "至55岁" ? 55 : 60;

            if (ppa.Age >=a && ppa.Age <80)
            {
                da.Value = ppa.Amount * 0.2;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            string s = ppa.PolicyActing.Policy.SelectedColRateFactors["养老金领取年龄"];

            int a = s == "至55岁" ? 55 : 60;

            if (ppa.Age ==a)
            {
                da.Value = ppa.Amount;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {

            if (ppa.Age == 80)
            {
                da.Value = ppa.Amount;
                ppa.IsCurrentFinish = true;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("身故"))
            {
                string s = ppa.PolicyActing.Policy.SelectedColRateFactors["养老金领取年龄"];

                int a = s == "至55岁" ? 55 : 60;
                if (ppa.Age < 18)
                {
                    da.Value = ppa.TotalFee;
                }
                else if (ppa.Age >= 18 && ppa.Age < a)
                {
                    da.Value = ppa.TotalFee + ppa.Amount * 5;
                }
                else
                {
                    da.Value = (79 - ppa.Age) * ppa.Amount * 0.2 + ppa.Amount;
                }

                ppa.IsCurrentFinish = true;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.SchemePeriodActing.InsurantStates.Contains("意外身故") )
            {
                ppa.SchemePeriodActing.InsurantStates.Add("身故");

                string s = ppa.PolicyActing.Policy.SelectedColRateFactors["养老金领取年龄"];

                int a = s == "至55岁" ? 55 : 60;
                if (ppa.Age >= 18 && ppa.Age < a)
                {
                    da.Value = ppa.Amount * 15;
                }

                ppa.IsCurrentFinish = true;
            }
        }

        public void Calc1(IPolicyPeriodActing ppa, IDutyActing da)
        {
            if (ppa.Period > 0 && ppa.PolicyActing.PeriodActings[ppa.Period - 1].SchemePeriodActing.InsurantStates.Contains("高度残疾"))
            {
                ppa.Fee = 0;
            }
        }
    }
}
